<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<script type="text/javascript">
    var as=[1,2,3,4,5];
    // let result=as.reduce(function(count,value){
    //     // if(value%2==0){
    //     //     return count+1;
    //     // }else{
    //     //     return count;
    //     // }
    //     return value%2==0?count+1:count;
    // },0);
    let result=as.reduce((count,value)=>value%2==0?count+1:count,0);
    console.log(result);
</script>
</body>
</html>